﻿using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
using Properties;

public class ConsoleForm : Form
{
    private readonly IContainer components;

    internal ConsoleUC consoleUC;

    public ConsoleUC Shell
    {
        get { return consoleUC; }
    }

    public ConsoleForm()
    {
        components = null;
        InitializeComponent();
    }

    protected override void Dispose(bool disposing)
    {
        bool disposed;

        if (!disposing)
            disposed = true;
        else
            disposed = components == null;

        if (!disposed)
            components.Dispose();

        base.Dispose(disposing);
    }

    private void InitializeComponent()
    {
        consoleUC = new ConsoleUC();
        SuspendLayout();
        consoleUC.AsyncCall = true;
        consoleUC.CurrentLine = "";
        consoleUC.Dock = DockStyle.Fill;
        consoleUC.Font = new Font("Lucida Console", 8.25f, FontStyle.Regular, GraphicsUnit.Point, 0);
        consoleUC.Location = new Point(0, 0);
        consoleUC.Name = "consoleUC";
        consoleUC.Prompt = "borg> ";
        consoleUC.ShellTextBackColor = Color.Black;
        consoleUC.ShellTextFont = new Font("Lucida Console", 9.75f, FontStyle.Regular, GraphicsUnit.Point, 0);
        consoleUC.ShellTextForeColor = Color.LightGray;
        consoleUC.Size = new Size(0x2b4, 0x16e);
        consoleUC.TabIndex = 0;
        AutoScaleDimensions = new SizeF(6f, 13f);
        AutoScaleMode = AutoScaleMode.Font;
        ClientSize = new Size(0x2b4, 0x16e);
        Controls.Add(consoleUC);
        Icon = Resources.console;
        Name = "ConsoleForm";
        StartPosition = FormStartPosition.Manual;
        Text = "Console";
        ResumeLayout(false);
    }

    protected override void OnVisibleChanged(EventArgs e)
    {
        bool visible = !Visible || Controls.Contains(consoleUC);

        if (!visible)
            Controls.Add(consoleUC);

        base.OnVisibleChanged(e);
    }
}

